<?php

use think\facade\Route;

$version = request()->header('version') ?? 'v1';

Route::group('expert', function() use ($version) {

    /**
     * 不需验证
     */
    Route::group('', function () use ($version) {
    });

    /**
     * 需验证
     */
    Route::group('', function () use ($version) {
        /*
         * 首页
         */
        Route::rule('home/:action', 'api.' . $version . '.expert.home.HomeController/:action');

        /*
         * 咨询订单
         */
        // 心理咨询订单
        Route::rule('consult/:action', 'api.' . $version . '.expert.order.ConsultController/:action');
        // 我的测试/订单
        Route::rule('om/:action', 'api.' . $version . '.expert.order.MultiController/:action');

        /*
         * 我的
         */
        Route::rule('mine/:action', 'api.' . $version . '.expert.mine.MineController/:action');
        Route::rule('amount/:action', 'api.' . $version . '.expert.mine.AmountController/:action');

        /*
         * 系统相关
         */
        Route::rule('site/upload', 'api.' . $version . '.expert.site.SiteController/upload');
        Route::rule('site/logout', 'api.' . $version . '.expert.site.SiteController/logout');

        /*
         * trtc
         */
        Route::rule('trtc/:action', 'api.' . $version . '.expert.trtc.TrtcController/:action');
    })->middleware([
        "app\middleware\\expert\\$version\AuthMiddleware"
    ]);
})->middleware([
    'cors'
]);
